#include <REGX52.H>
#include "NiXie.h"
#include "IR.h"
#include "Motor.h"

unsigned char Speed,Command;


void main()
{
	
	Motor_Init();
	IR_Init();
	while(1)
	{
		if (IR_GetDataFlag())
		{
			Command = IR_GetCommand();
			if (IR_0 == Command)
			{
				Motor_SetSpeed(0);
				Speed = 0;
			}
			if (IR_1 == Command)
			{
				Motor_SetSpeed(45);
				Speed = 1;
			}
			if (IR_2 == Command)
			{
				Motor_SetSpeed(70);
				Speed = 2;
			}
			if (IR_3 == Command)
			{
				Motor_SetSpeed(100);
				Speed = 3;
			}
		}
		NiXie(1,Speed);
		
	}
}























